package 
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import kTest.MoveTest;
	import model.battle.Army;
	import model.battle.Heartbeat;
	import roleView.RoleSkin;
	
	/**
	 * ...
	 * @author Kylin206
	 */
	public class Main extends Sprite 
	{
		public static var instance:Main;
		private var hb:Heartbeat;
		private	var test:MoveTest;
		public function Main():void 
		{
			instance = this;
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event = null):void 
		{
			Army.init();
			test = new MoveTest();
			removeEventListener(Event.ADDED_TO_STAGE, init);
			hb = Heartbeat.instance;
			this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
			this.stage.addEventListener(MouseEvent.CLICK, stage_click);
			test.start();
		}
		
		private function stage_click(e:MouseEvent):void 
		{
			test.onStageClick();
		}
		
		private function enterFrameHandler(e:Event):void 
		{
			hb.beat();
		}
		
		
		
		
	}
	
}